package com.itcast.generic;

class MyClass <T> {
    // 判断传入的数据是否是浮点数类型
    public void judgeDouble(T t) {
        System.out.println(t instanceof Double);
    }
}

class Test2 {
    public static void main(String[] args) {
        // 传入字符串试试
        String s = "字符串数据";
        MyClass<String> myClass = new MyClass<>();
        myClass.judgeDouble(s);

        // 传入浮点数
        Double d = 1.3425;
        MyClass<Double> myClass1 = new MyClass<>();
        myClass1.judgeDouble(d);
    }
}


